<?php
include_once("codelibrary/inc/variables.php");
include_once("session.php");
include_once("codelibrary/inc/functions.php");

$page="customer-view-details.php";
$business_id = $_SESSION['business_id'];


		if(!isset($pageno))
		$pageno=0;
	
		if(!isset($sortField))
		{
			$sortField="lastname";
		}
		
		if(!isset($order))
		{
				//variable on the basis of which sorting will be performed
				$order="asc";
		}

		//index of table from where to show the records
			$startIndex=$paging*($pageno);
		
		//limit variable 
			$limit=" LIMIT $startIndex,$paging";
			
		    $adminQuery = "select * from $customer_info_table where 1=1 and business_id='$business_id'";
	 
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="LTR" lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Online Appointment</title>
<script language="JavaScript1.2" src="codelibrary/js/common.Js"></script>
<script>
            
			var iDelTotalChecked=0
			function objDelChecked(chk)
			{
				if(chk.checked==true)
					iDelTotalChecked=iDelTotalChecked+1
				else
					iDelTotalChecked=iDelTotalChecked-1
			}

			function ConfirmChoice() 
			{ 
				if(iDelTotalChecked==0)
				{
					alert("Please select at least one record to delete.");
					return false; 
				}
				else
				{
					answer = confirm("Are you sure you want to Delete the selected Customer(s)?")

					if (answer !=0) 
					{ 
						return true; 
					} 
					else
					{
						return false; 
					}
				}
			}

			function goDelete()
			{		
				document.frm2.action="delete-customer.php";
				document.frm2.submit();
			}

			function goEdit(idval)
			{
			    
				document.frm2.id.value=idval;
				document.frm2.action="edit-customer.php?type=1";
				document.frm2.submit();
			}

			function send(pn,ord,sf,srchkwd)
			{	
				document.frm2.pageno.value=pn;
				document.frm2.order.value=ord;
				document.frm2.sortField.value=sf;
				document.frm2.keyword.value=srchkwd;
				document.frm2.submit();
			}
			function submitform()
			{
				if(document.search_form.MR_Distance_Cleared.value=="")
				{
					alert("Do Not Leave Search Field Blank");
					document.search_form.MR_Distance_Cleared.focus();
					return false;
				}
				else
				{
					return true;
				}
			}


</script>

<base >
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<title>Staff Management</title>

</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">


<table cellpadding="0" cellspacing="0" border="0"><tr>
  <td style="background:url(images/top.gif) repeat-x top; ">
<table cellpadding="0" cellspacing="0" border="0" style="width:764px" align="center"> 
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" border="0" style="height:57">
				<tr>
					<td height="57">
<? html_header(); ?>					</td>
				</tr>
			</table>


		</td>
	</tr>
	<tr>
		<td>





<table border="0" width="105%" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top" class="col_left">

<table border="0"cellspacing="0" cellpadding="0" class="box_width_left">
	<tr><td width="100%">
		<table border="0" cellspacing="0" cellpadding="0">
<tr><td>

<table border="0" width="100%" cellspacing="0" cellpadding="0" class="">
  <tr>
    <td>
    <table border="0" width="100%" cellspacing="0" cellpadding="0"  class="" height="91">
  <tr>
    <td align="center" height="91">
    <img border="0" src="images/logo.jpg" width="208" height="86"></td>
  </tr>
</table>
</td>
  </tr>
</table>
</td></tr>


          <tr>
            <td>
<table border="0" width="100%" cellspacing="0" cellpadding="0"  class="box_header_txt" height="48">
  <tr>
    <td style="background-image: url(images/1_bg2-2.gif)" height="1">
      <p style="margin-top: 16"> </td>
  </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0"   style="border-bottom:12px solid #ffffff;">
  <tr>
    <td>
    <table border="0" width="100%" cellspacing="0" cellpadding="0"  style="margin-bottom:0px;background:#7C7C7C url(images/1_line.gif) no-repeat left bottom;" >
  <tr>
    <td  style="padding:3px 16px 8px 25px;">
      <table width="100%" border="0" cellspacing="5">
        <tr>
          <td><a href="add-customer.php" class="topmenulink"><strong>Add New Customer</strong></a></td>
          </tr>
        <tr>
          <td><a href="merge-customer.php" class="topmenulink"></a></td>
          </tr>
		 
      </table>
    </td>
  </tr>
</table>
</td>
  </tr>
</table>
            </td>
          </tr>


          <tr>
            <td class="">&nbsp;
</td>
          </tr>

		</table>
	</td>
	<td><img src="images/spacer.gif" border="0" alt="" width="15" height="1"></td></tr>
</table>

    </td>

    <td width="100%" valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="0"  class="cont_header_txt">
  <tr>
    <td>
			<table border="0" cellpadding="0" cellspacing="0" bgcolor="#EAEAEA" class="cont_header_txt">
				<tr>
					<td><img src="images/1_q1.gif" border="0" alt="" width="45" height="39"></td>
					<td style="width:100%">Add Customer Record</td>
					<td><img src="images/1_q2.gif" border="0" alt="" width="10" height="39"></td>
				</tr>
			</table>										 
			</td>
  </tr>
</table>


						
						<table cellpadding="0" cellspacing="0" border="0" style="border:0px solid #DEDEDE; border-width:0px 1px 0px 1px;">
						 <tr>
<td width="100%" align="center" valign="top" style="background:#ffffff;border:0px solid #ffffff; border-width:18px 5px 10px 5px;">
	<table cellpadding="0" cellspacing="0" border="0" width="95%" align="center" bgcolor="#CCCCCC">
	<tr>
	<td class="table_text3" nowrap>
<a href="customer-view-details.php?action=search_customer&popup=&letter=A">A</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=B">B</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=C">C</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=D">D</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=E">E</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=F">F</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=G">G</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=H">H</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=I">I</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=J">J</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=K">K</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=L">L</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=M">M</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=N">N</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=O">O</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=P">P</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=Q">Q</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=R">R</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=S">S</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=T">T</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=U">U</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=V">V</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=W">W</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=X">X</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=Y">Y</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=Z">Z</a>&nbsp;
<a href="customer-view-details.php?action=search_customer&popup=&letter=all">List all</a>
<br>(alphabet search and list all apply to location selected above)
	</td>
	</tr>
	</table>
</td>
</tr>
                          <tr>
                            <td style="background:#ffffff;border:0px solid #ffffff; border-width:18px 5px 10px 5px;"><!-- new_products //-->
                                <table border="0" width="" cellspacing="0" cellpadding="0">
                                  <tr>
                                    <td>				   
				  <form name="search_form" method="post" action="<?=$page;?>">
				  <table width="94%" border="1" cellpadding="3" cellspacing="2" bordercolor="#FFDBCA" class="table">
				  				  <tr>
                                    <td width="30%" height="27" valign="bottom" class="simpletxt">&nbsp;&nbsp;Location </td>
                                    <td width="70%" height="27" colspan="2" valign="bottom" class="simpletxt">
						<select name="TN_Location">
                          <option value="">--All Locations--</option>
                          <?
				        $res_location=mysql_query("select * from $business_info_table where (business_id='$business_id' or parent='$business_id') order by sortorder");   
						while($row_location=mysql_fetch_array($res_location))
						{
						    $locationid=$row_location["business_id"];
							$locationname=$row_location["locationname"];
							echo "<option value='$locationid'";
							if(isset($TN_Location) && ($TN_Location!=''))
							{
								
									if($TN_Location==$locationid)
									{		
										echo " selected";
									}
							}
							echo ">".$locationname."</option>";
						}
					      ?>
                        </select>
                                    </td>
                                  </tr>
								  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;&nbsp;Last Name </td>
                                    <td height="27" colspan="2" valign="bottom" class="simpletxt"><INPUT name="TN_LastName" type="TEXT" value="<? if(isset($TN_LastName))echo $TN_LastName;?>" size="30">
                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;&nbsp;First Name </td>
                                    <td height="27" colspan="2" valign="bottom" class="simpletxt"><INPUT name="TN_FirstName"  type="TEXT" value="<? if(isset($TN_FirstName))echo $TN_FirstName;?>" size="30">
                                    </td>
                                  </tr>
                                  
                                 <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;&nbsp;Address </td>
                                    <td height="27" colspan="2" valign="bottom" class="simpletxt"><textarea name="TN_Address" rows="3" cols="3"><? if(isset($TN_Address))echo $TN_Address;?>
</textarea></td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;&nbsp;City </td>
                                    <td height="27" colspan="2" valign="bottom" class="simpletxt"><INPUT name="TN_City"  type="TEXT" value="<? if(isset($TN_City))echo $TN_City;?>" size="30"></td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;&nbsp;State </td>
                                    <td height="27" colspan="2" valign="bottom" class="simpletxt"><INPUT name="TN_State"  type="TEXT"  value="<? if(isset($TN_State))echo $TN_State;?>" size="30"></td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;&nbsp;Zip Code </td>
                                    <td height="27" colspan="2" valign="bottom" class="simpletxt"><INPUT name="TN_Zip"  type="TEXT" value="<? if(isset($TN_Zip))echo $TN_Zip;?>" size="30"></td>
                                  </tr>
								  <tr>
									<td height="27" valign="bottom" class="simpletxt">&nbsp;&nbsp;Company </td>
									 <td height="27" colspan="2" valign="bottom" class="simpletxt">
										<INPUT name="TN_Company" type="TEXT" value="<? if(isset($TN_Company))echo $TN_Company;?>">        
									</td>
							      </tr>
								  <tr>
                                    <td height="27" valign="bottom" class="simpletxt"><strong>&nbsp;</strong>&nbsp;E-mail </td>
                                    <td height="27" colspan="2" valign="bottom" class="simpletxt"><INPUT name="TN_Email" type="TEXT" value="<? if(isset($TN_Email))echo $TN_Email;?>" size="30">
                                    </td>
                                  </tr>
								  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;&nbsp;Daytime Phone </td>
                                    <td height="27" colspan="2" valign="bottom" class="simpletxt"><INPUT name="PHN_DayPhone" type="TEXT" value="<? if(isset($PHN_DayPhone))echo $PHN_DayPhone;?>" size="30">
                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;&nbsp;Evening Phone </td>
                                    <td height="27" colspan="2" valign="bottom" class="simpletxt"><INPUT name="PHN_EveningPhone" type="TEXT" value="<? if(isset($PHN_EveningPhone))echo $PHN_EveningPhone;?>" size="30">
                                    </td>
                                  </tr>
								  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;&nbsp;Cell Phone </td>
                                    <td height="27" colspan="2" valign="bottom" class="simpletxt"><INPUT name="PHN_CellPhone" type="TEXT" value="<? if(isset($PHN_CellPhone))echo $PHN_CellPhone;?>" size="30">
                                    </td>
                                  </tr>
								  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;&nbsp;Account Number </td>
                                    <td height="27" colspan="2" valign="bottom" class="simpletxt"><INPUT name="TN_AccountNumber" type="TEXT" value="<? if(isset($TN_AccountNumber))echo $TN_AccountNumber;?>" size="30">
                                    </td>
                                  </tr>
								  <tr>
                                  <td height="27" colspan="3" align="right" valign="bottom" nowrap class="simpletxt">
								  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								  <input name="search" type="radio" value="any" <? if(!isset($search)||($search==""))
								{ 
									echo "checked";
								}  
								if(isset($search) && $search=="any"){ echo "checked";}?> >
                &nbsp;&nbsp;Anywhere&nbsp;&nbsp; 
                
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<input name="search" type="radio" value="startwith" 
								<? if(isset($search) && $search=="startwith"){ echo "checked";}?> >
                &nbsp;&nbsp;Starting With&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
				
				<input name="search" type="radio" value="exact" <? if(!isset($search)||($search==""))
								{ 
									echo "checked";
								}  
								if(isset($search) && $search=="exact"){ echo "checked";}?> >
                &nbsp;&nbsp;Exact&nbsp;&nbsp;								  </td>
								  </tr>
								  <tr>
                                  <td height="27" colspan="3" align="center" valign="bottom" nowrap class="smallText"><span class="simpletxt">Sort By </span>&nbsp;&nbsp;&nbsp;            <select name="TN_SortBy">
                    
                      <option value='lastname'  
				   <? 
				      if(!isset($TN_SortBy))
					  {
					     echo "selected";
					  }
				      if(isset($TN_SortBy) && $TN_SortBy=="lastname")
			          {
					     echo "selected";
					  }
					?>>Last Name</option>
					
					<option value='firstname'  
				   <? 
				      
				      if(isset($TN_SortBy) && $TN_SortBy=="firstname")
			          {
					     echo "selected";
					  }
					?>>First Name</option>
					<option value='city'  
				   <? 
				      
				      if(isset($TN_SortBy) && $TN_SortBy=="city")
			          {
					     echo "selected";
					  }
					?>>City</option>
					<option value='state'  
				   <? 
				      
				      if(isset($TN_SortBy) && $TN_SortBy=="state")
			          {
					     echo "selected";
					  }
					?>>State</option>
					</select>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input name="Search" type="submit" class="button" value="Search"></td>
                                  </tr>
                                </table>
								</form>
                  <?php
			if($_REQUEST['action']=="search_customer")
			{
			    $searchky=$_REQUEST['letter'];
				
			    if($searchky=="all")
				{
				   
				}
				else
				{
				   
				   $adminQuery.=" and lastname LIKE '%$searchky%'";
				}
				
			}
			if(isset($TN_Location) && $TN_Location!="")
			{
				$searchky=$TN_Location;
				$adminQuery.=" and business_id =$searchky";
				
			}	  
			if(isset($TN_LastName) && $TN_LastName!="")
			{
				$searchky=$TN_LastName;
				$searchorder=$search;
				if($searchorder=="any")
				{
				$adminQuery.=" and lastname LIKE '%$searchky%'";
				}
				elseif($searchorder=="startwith")
				{	
					$adminQuery.=" and lastname LIKE '$searchky%'";
				}
				elseif($searchorder=="exact")
				{	
					$adminQuery.=" and lastname = '$searchky'";
				}
				
			}
			if(isset($TN_FirstName) && $TN_FirstName!="")
			{
				$searchky=$TN_FirstName;
				$searchorder=$search;
				if($searchorder=="any")
				{
				$adminQuery.=" and firstname LIKE '%$searchky%'";
				}
				elseif($searchorder=="startwith")
				{	
					$adminQuery.=" and firstname LIKE '$searchky%'";
				}
				elseif($searchorder=="exact")
				{	
					$adminQuery.=" and firstname = '$searchky'";
				}		
			}
			if(isset($TN_Address) && $TN_Address!="")
			{
				$searchky=$TN_Address;
				$searchorder=$search;
				if($searchorder=="any")
				{
				$adminQuery.=" and address LIKE '%$searchky%'";
				}
				elseif($searchorder=="startwith")
				{	
					$adminQuery.=" and address LIKE '$searchky%'";
				}
				elseif($searchorder=="exact")
				{	
					$adminQuery.=" and address = '$searchky'";
				}		
			}
			if(isset($TN_City) && $TN_City!="")
			{
				$searchky=$TN_City;
				$searchorder=$search;
				if($searchorder=="any")
				{
				$adminQuery.=" and city LIKE '%$searchky%'";
				}
				elseif($searchorder=="startwith")
				{	
					$adminQuery.=" and city LIKE '$searchky%'";
				}
				elseif($searchorder=="exact")
				{	
					$adminQuery.=" and city = '$searchky'";
				}		
			}
			if(isset($TN_State) && $TN_State!="")
			{
				$searchky=$TN_State;
				$searchorder=$search;
				if($searchorder=="any")
				{
				$adminQuery.=" and state LIKE '%$searchky%'";
				}
				elseif($searchorder=="startwith")
				{	
					$adminQuery.=" and state LIKE '$searchky%'";
				}
				elseif($searchorder=="exact")
				{	
					$adminQuery.=" and state = '$searchky'";
				}		
			}
			if(isset($TN_Zip) && $TN_Zip!="")
			{
				$searchky=$TN_Zip;
				$searchorder=$search;
				if($searchorder=="any")
				{
				$adminQuery.=" and zipcode LIKE '%$searchky%'";
				}
				elseif($searchorder=="startwith")
				{	
					$adminQuery.=" and zipcode LIKE '$searchky%'";
				}
				elseif($searchorder=="exact")
				{	
					$adminQuery.=" and zipcode = '$searchky'";
				}		
			}
			if(isset($TN_Company) && $TN_Company!="")
			{
				$searchky=$TN_Company;
				$searchorder=$search;
				if($searchorder=="any")
				{
				$adminQuery.=" and companyname LIKE '%$searchky%'";
				}
				elseif($searchorder=="startwith")
				{	
					$adminQuery.=" and companyname LIKE '$searchky%'";
				}
				elseif($searchorder=="exact")
				{	
					$adminQuery.=" and companyname = '$searchky'";
				}		
			}
			if(isset($TN_Email) && $TN_Email!="")
			{
				$searchky=$TN_Email;
				$searchorder=$search;
				if($searchorder=="any")
				{
				$adminQuery.=" and email LIKE '%$searchky%'";
				}
				elseif($searchorder=="startwith")
				{	
					$adminQuery.=" and email LIKE '$searchky%'";
				}
				elseif($searchorder=="exact")
				{	
					$adminQuery.=" and email = '$searchky'";
				}		
			}
			if(isset($PHN_DayPhone) && $PHN_DayPhone!="")
			{
				$searchky=$PHN_DayPhone;
				$searchorder=$search;
				if($searchorder=="any")
				{
				$adminQuery.=" and dayphone LIKE '%$searchky%'";
				}
				elseif($searchorder=="startwith")
				{	
					$adminQuery.=" and dayphone LIKE '$searchky%'";
				}
				elseif($searchorder=="exact")
				{	
					$adminQuery.=" and dayphone = '$searchky'";
				}		
			}
			if(isset($PHN_EveningPhone) && $PHN_EveningPhone!="")
			{
				$searchky=$PHN_EveningPhone;
				$searchorder=$search;
				if($searchorder=="any")
				{
				$adminQuery.=" and eveningphone LIKE '%$searchky%'";
				}
				elseif($searchorder=="startwith")
				{	
					$adminQuery.=" and eveningphone LIKE '$searchky%'";
				}
				elseif($searchorder=="exact")
				{	
					$adminQuery.=" and eveningphone = '$searchky'";
				}		
			}
			if(isset($PHN_CellPhone) && $PHN_CellPhone!="")
			{
				$searchky=$PHN_CellPhone;
				$searchorder=$search;
				if($searchorder=="any")
				{
				$adminQuery.=" and cellphone LIKE '%$searchky%'";
				}
				elseif($searchorder=="startwith")
				{	
					$adminQuery.=" and cellphone LIKE '$searchky%'";
				}
				elseif($searchorder=="exact")
				{	
					$adminQuery.=" and cellphone = '$searchky'";
				}		
			}
			if(isset($TN_AccountNumber) && $TN_AccountNumber!="")
			{
				$searchky=$TN_AccountNumber;
				$searchorder=$search;
				if($searchorder=="any")
				{
				$adminQuery.=" and accountnumber LIKE '%$searchky%'";
				}
				elseif($searchorder=="startwith")
				{	
					$adminQuery.=" and accountnumber LIKE '$searchky%'";
				}
				elseif($searchorder=="exact")
				{	
					$adminQuery.=" and accountnumber = '$searchky'";
				}		
			}
			
		if((isset($sortField)&& $sortField!="") && (isset($order) && $order!=""))
			{
				$sortcriteria=$sortField;
				$sortordering=$order;
			}
			else
			{
				$sortcriteria="lastname";
			    $sortordering="asc";
            }
	    if(isset($TN_SortBy)  && $TN_SortBy!="")
		{
		    $sortcriteria=$TN_SortBy;
			$sortordering="desc";
		}
			
		$adminQuery.=" ORDER BY $sortcriteria $sortordering";
		//echo $adminQuery;
		$adminRecord=mysql_query($adminQuery);
	    $totalNoOfRecords=mysql_num_rows($adminRecord);
	    $pagesReq=ceil($totalNoOfRecords/$paging);
		
		?>
                  <form name="frm2" method="post" action="<?=$page;?>">
                    <input type="hidden" name="pageno" value="<?=$pageno;?>" >
                    <input type="hidden" name="limit" value="<?=$paging;?>" >
                    <input type="hidden" name="totalNoOfRecords" value="<?=$totalNoOfRecords;?>" >
                    <input type="hidden" name="order" value="<?=$order;?>">
                    <input type="hidden" name="sortField" value="<?=$sortField;?>">
                    <input type="hidden" name="search" value="<?=$search;?>">
                    <input type="hidden" name="keyword" value="<?=$keyword;?>">
                    <input type="hidden" name="activate_status" value="<? if(isset($activate_status)) echo $activate_status;?>">
					<input type="hidden" name="id" >
                    <table cellpadding="0" cellspacing="0" border="0" style="border:0px solid #DEDEDE; border-width:0px 1px 0px 1px;">
                      <tr>
                        <td style="background:#ffffff;border:0px solid #ffffff; border-width:18px 5px 10px 5px;"><table border="0" width="" cellspacing="0" cellpadding="0">
                            <tr>
                              <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                                  <tr>
                                    <td><table width="100%" border="0" cellpadding="3" cellspacing="2">
                                        <tr>
                                          <!-- error info starts-->
                                          <td align="center" class="errTxt">
										  <? 
										  if(isset($msg))
										  {
										  ?>
												Customer
												<?=$msg;?>
												Successfully.
																
																
										<? 
										}
										?>
                                            &nbsp;</td>
                                          <!-- error info ends-->
                                        </tr>
                                        <tr>
                                          <!-- error info starts-->
                                          <td align="center" class="errTxt">&nbsp;</td>
                                          <!-- error info ends-->
                                        </tr>
                                        <tr>
                                          <td valign="top"><!-----------------Content Table starts here------------------->
                                            <?
	                            ##############outer if starts###########################
	 
	  
      
	  if($totalNoOfRecords>0) 
				{ 
	?>
                                            <table width="100%" border="1" align="center" cellpadding="2" cellspacing="1" bordercolor="#FFDBCA" class="table" background-color ="#ffffff">
                                              <tr align="left">
                                                <td width="8%" class="thead" align="center"><input name="delete" type="submit" class="button" value="Delete" onClick="if(ConfirmChoice())goDelete();else return false;" align="center">
                                                </td>
                                                <td class="thead" nowrap width="14%" align="center"><a href="javascript:;" onClick="send(<? print $pageno;
													print ",'";
													print "asc";
													print "'";
													print ",";
													print "'";
													print "lastname";
													print "',";
													print "'";
													print trim($keyword);
													print "'";
													?>); return false;"> <img src="images/up.gif" alt="Up" width="11" height="5" border="0"></a><span class="H1">Customer Name</span><a href="javascript:;"onClick="send(<? print 				 $pageno;
													print ",'";
													print "desc";
													print "'";
													print ",";
													print "'";
													print "lastname";
													print "',";
													print "'";
													print trim($keyword);
													print "'";
													?>); return false;"><img src="images/down.gif" alt="Down" width="11" height="5" border="0"></a> </td>
                                                
                                                <td class="thead" nowrap width="14%" align="center"><a href="javascript:;" onClick="send(<? print $pageno;
													print ",'";
													print "asc";
													print "'";
													print ",";
													print "'";
													print "email";
													print "',";
													print "'";
													print trim($keyword);
													print "'";
													?>); return false;"> <img src="images/up.gif" alt="Up" width="11" height="5" border="0"></a><span class="H1">E-mail Address<a href="javascript:;"onClick="send(<? print 				 $pageno;
													print ",'";
													print "desc";
													print "'";
													print ",";
													print "'";
													print "email";
													print "',";
													print "'";
													print trim($keyword);
													print "'";
													?>); return false;"><img src="images/down.gif" alt="Down" width="11" height="5" border="0"></a></span> </td>
													<td class="thead" nowrap width="14%" align="center"><a href="javascript:;" onClick="send(<? print $pageno;
													print ",'";
													print "asc";
													print "'";
													print ",";
													print "'";
													print "dayphone";
													print "',";
													print "'";
													print trim($keyword);
													print "'";
													?>); return false;"> <img src="images/up.gif" alt="Up" width="11" height="5" border="0"></a><span class="H1">Phone Numbers</span><a href="javascript:;"onClick="send(<? print 				 $pageno;
													print ",'";
													print "desc";
													print "'";
													print ",";
													print "'";
													print "dayphone";
													print "',";
													print "'";
													print trim($keyword);
													print "'";
													?>); return false;"><img src="images/down.gif" alt="Down" width="11" height="5" border="0"></a> </td>
                                                <td class="H1" width="17%" align="center"> Action </td>
                                              </tr>
                                              <?
							#################while to print content row start########
							$adminQuery.=$limit;
	  						//echo $adminQuery; 
							$Record=mysql_query($adminQuery);	
							$i=1;
			                while($fetchRow=mysql_fetch_array($Record))
							{
				               $id=$fetchRow['customer_id'];
							   $customer_name = $fetchRow['lastname'].","." ".$fetchRow['firstname'];
						?>
                                              <tr align="left">
                                                <td height="23" class="smallText" align="center"><input name="checkbox[]" type="checkbox" value="<?=$fetchRow['customer_id'];?>" onClick='objDelChecked(this)' >
                                                </td>
                                                <td class="smallText" align="center">
												<a href="edit-customer.php?id=<?=$id;?>"><?=$customer_name;?></a>
												
                                                </td>
                                                <td class="smallText" align="center">
												<?
					                              echo $fetchRow['email'];
					   
					                            ?>
                                                </td>
                                                <td class="smallText" align="center">Daytime Phone:&nbsp;&nbsp;<? if($fetchRow['dayphone']!=0){echo nl2br($fetchRow['dayphone']);}?><br> Eveningtime Phone:&nbsp;&nbsp;<? if($fetchRow['eveningphone']!=0){echo nl2br($fetchRow['eveningphone']);}?><br>Cell Phone:&nbsp;&nbsp;<? if($fetchRow['cellphone']!=0){echo nl2br($fetchRow['cellphone']);}?>
                                                </td>
                                                <td class="smallText" noWrap align="center"><a href="javaScript:;" onClick="goEdit('<?=$fetchRow["customer_id"]?>');return false;" class="alink">Edit</a> 
                                                  
                                                  <? 
												$i++;
										  }  ##############end of while###########
								?>
                                            </table>
                                            <? 
							} ##############end of outer if ########################
							else
							{
						?>
                                            <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
                                              <tr align="center">
                                                <td width="100%" class="errTxt"> No Customer Details Found </td>
                                              </tr>
                                            </table>
                                            <?
							}   ##################else ends##########################
						?>
                                          </td>
                                        </tr>
                                        
                                      </table></td>
                                  </tr>
                                  <tr>
                                    <!-- Paging td starts here   -->
                                    <td class="pagingtxt" align="right"><br>
                                      <?
						#################### paging starts ##################
						$page_text=display_paging($totalNoOfRecords,$paging,$pageno);
						echo $page_text;

						#################### paging Ends ##################
						?>
                                      <!--  paging table ends  -->
                                      <script>
							function page_list(pg)
							{
								document.frm2.pageno.value=pg;
								document.frm2.action="<?=$page;?>";
								document.frm2.submit();
							}
							</script>
                                    </td>
                                    <!-- Paging td ends here   -->
                                  </tr>
                                </table></td>
                            </tr>
                          </table></td>
                      </tr>
                    </table>
                  </form>
</td>
                                  </tr>
                                </table>
                              <table border="0" cellspacing="0" cellpadding="0" align="center">
                                  <tr>
                                    <td></td>
                                  </tr>
                              </table></td>
                          </tr>
                        </table>
						
						<table cellpadding="0" cellspacing="0" border="0">
							<tr>
								<td><img src="images/1_q4.gif" border="0" alt="" width="10" height="10"></td>
								<td style="width:100%; background-image:url(images/1_li1.gif)"></td>
								<td><img src="images/1_q3.gif" border="0" alt="" width="10" height="10"></td>
							</tr>
						</table>
						


		
		
		</td>

    <td class="col_right">

<table border="0"cellspacing="0" cellpadding="0" class="box_width_right">
	<tr><td></td>
		<td width="100%">
			<table border="0" cellspacing="0" cellpadding="0">
				<tr><td></td></tr>
			</table>
		</td>
	</tr>
</table>


    </td>
  </tr>
</table>



		</td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" border="0" style="height:98px; background-image:url(images/bot.gif)">
				<tr>
					<td>
						<table cellpadding="0" cellspacing="0" border="0" class="footer">
							<tr>									
								<td height="77"><img src="images/spacer.gif" border="0" alt="" width="25" height="1"></td>				
								<td style="width:207px"><br style="line-height:49px"><img src="images/p1.gif" border="0" alt="" width="145" height="24"><br></td>
							  <td style="width:532px">&nbsp;</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table></td></tr></table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center"></td>
  </tr>
</table>
</body>

</html>